package controllers

import (
	"gin-project-01/gin-step04/gin16-multi-tables/models"
	"github.com/gin-gonic/gin"
	"net/http"
)

// BaseController
// @Description: 控制器继承
type BaseController struct {
}

// Success
//
//	@Description: 成功
//	@receiver base
//	@param c
//	@param data
func (base BaseController) Success(c *gin.Context, data any) {
	c.JSON(http.StatusOK, models.Success("", data))
}

// Error
//
//	@Description: 失败
//	@receiver base
//	@param c
func (base BaseController) Error(c *gin.Context, msg any) {
	c.JSON(http.StatusOK, models.Fail(msg))

}
